home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 10
/
The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso
/
PC_SIGCD
/
03
/
4
/
DISK0341.ZIP
/
ADDLF.C
< prev
next >
Wrap
Text File
|
1983-10-27
|
640b
|
25 lines
/* addlf -- copy input to output; add line-feeds only if necessary.
* WHRauser 10-4-83 a better mouse trap.
*/
#include <stdio.h> /* Microsoft C Ver 1.04 */
#define CR 0x000D /* carriage return */
#define LF 0x000A /* line feed */
#define TRUE 1
#define FALSE 0
main() /* copy input to output and add line-feeds only if needed. */
{
int c;
int addlf = FALSE;
while ((c = getchar()) != EOF) {
if (addlf & c != LF) {
putchar(LF);
addlf = FALSE;
}
putchar(c);
if (c == CR) addlf = TRUE;
}
}